/*
 * @Author: 孙大大
 * @Date: 2022-04-13 15:28:11
 * @LastEditTime: 2022-04-13 15:32:33
 * @FilePath: \黑马面面 - 副本\src\api\companys.js
 */
import request from "@/utils/request";

//获取数据
export function shuju(params) {
  return request({
    url: "/companys",
    method: "GET",
    params,
  });
}
//添加
export function newdata(data) {
  return request({
    url: "/companys",
    method: "post",
    data,
  });
}
//修改前确认是否id一样
export function editdata(params) {
  return request({
    url: "/companys/" + params + "?id=" + params,
    method: "get",
  });
}
//开始修改
export function editdatab(data) {
  return request({
    url: "/companys/" + data.id,
    method: "put",
    data,
  });
}
//删除
export function deletedata(data) {
  return request({
    url: "/companys/" + data.id,
    method: "delete",
    data,
  });
}
//状态修改
export function xiuzhuangtai(id, data) {
  return request({
    // url: "/companys/" + data.id + "/" + data.state,
    url: `/companys/${id}/${data.state}`,
    method: "post",
  });
}
//搜索
export function search(data) {
  console.log(data);
  return request({
    url: `/companys`,
    method: "get",
    params: data,
  });
}
